<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="../themes/css/global_n.css" />
<link rel="stylesheet" type="text/css" href="../themes/css/iframe.css" />
<script src="../js/echarts/echarts.js"></script>
 <script src="../data/data.js"></script>
</head>
<body>
 <div style="width:750px;height:100%;" id="main"> </div>
        <script>
		 require.config({
				paths: {
					echarts: '../js/echarts'
				}
			});
		 require(
			[
				'echarts',
				'echarts/chart/pie',
				'echarts/chart/bar',
				'echarts/chart/map',
				'echarts/chart/line'
			],
			function (ec) {
                var myChart = ec.init(document.getElementById('main'));
                var  option = {
                    tooltip : {
                        trigger: 'axis'
                    },
                    grid:{
                        borderWidth:0
                    },
                    legend: {
                        textStyle:{
                            color:'#FFF'
                        },
                        data:legendData
                    },
                    calculable : true,
                    xAxis : [
                        {
                            type : 'value',
                            boundaryGap : [0, 0.01],
                            splitLine:{show:false}
                        }
                    ],
                    yAxis : [
                        {
                            type : 'category',
                            axisLabel : {
                                show:true,
                                interval: 'auto',    // {number}
                                rotate: 0,
                                margin: 8,
                                formatter: '{value}',
                                textStyle: {
                                    color: '#FFF'
                                }
                            },
                            data : data.AreaData,
                            splitLine:{show:false}

                        }
                    ],
                    series : (function(){
                        var returndd=[];
                        var len=legendData.length;
                        for (var i=0;i<len;i++){
                            var obj={};
                            obj.name=legendData[i];
                            obj.type='bar';
                            // 数据值
                            var valData=[];
                            switch (legendData[i]){
                                case"资金需求":
                                    for(var ii=0;ii<data.AreaData.length;ii++){
                                        debugger;
                                        var visit=true;
                                        for(var ij=0;ij<data.ReqData.length;ij++){
                                            var ij_data=data.ReqData[ij];
                                            if(data.AreaData[ii]==ij_data.name){
                                                valData.push(ij_data.value);
                                                visit=false;
                                            }
                                        }
                                        if(visit){
                                            valData.push(0)
                                        }
                                    }
                                    break;
                                case"下达资金":
                                    for(var ii=0;ii<data.AreaData.length;ii++){
                                        var visit=true;
                                        for(var ij=0;ij<data.issueFunds.length;ij++){
                                            var ij_data=data.issueFunds[ij];
                                            if(data.AreaData[ii]==ij_data.name){
                                                valData.push(ij_data.value);
                                                visit=false;
                                            }
                                        }
                                        if(visit){
                                            valData.push(0)
                                        }
                                    }
                                    break;
                                case"到位资金":
                                    for(var ii=0;ii<data.AreaData.length;ii++){
                                        var visit=true;
                                        for(var ij=0;ij<data.placeFunds.length;ij++){
                                            var ij_data=data.placeFunds[ij];
                                            if(data.AreaData[ii]==ij_data.name){
                                                valData.push(ij_data.value);
                                                visit=false;
                                            }
                                        }
                                        if(visit){
                                            valData.push(0)
                                        }
                                    }
                                    break;
                                case"支付情况":
                                    for(var ii=0;ii<data.AreaData.length;ii++){
                                        var visit=true;
                                        for(var ij=0;ij<data.payFunds.length;ij++){
                                            var ij_data=data.payFunds[ij];
                                            if(data.AreaData[ii]==ij_data.name){
                                                valData.push(ij_data.value);
                                                visit=false;
                                            }
                                        }
                                        if(visit){
                                            valData.push(0)
                                        }
                                    }
                                    break;
                                case"完成资金":
                                    for(var ii=0;ii<data.AreaData.length;ii++){
                                        var visit=true;
                                        for(var ij=0;ij<data.finishFunds.length;ij++){
                                            var ij_data=data.finishFunds[ij];
                                            if(data.AreaData[ii]==ij_data.name){
                                                valData.push(ij_data.value);
                                                visit=false;
                                            }
                                        }
                                        if(visit){
                                            valData.push(0)
                                        }
                                    }
                                    break;

                            }
                            // 数据
                            obj.data=valData;
                            returndd.push(obj);
                        }
                        return returndd;
                    })()
                };
                myChart.setOption(option, true);
            });
		 </script>
</body>
</html>
